import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const $cache	= $Lazy.file(()=>import('#private/cache-api'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		// 提交表单列表
		formData : [
			{ label: '办事处地址',     name: 'address_id', 	full:true, 	type:'select',	required:true }
		]
	}

	open = (uuid)=> {
		this.submit ={ uuid }
		this.getModalSelect()
		this.modal.open({formRef: this.formRef})
	}
	
	// 获取弹框下拉
	getModalSelect = async () => {
		const { formData } = this.state
		$fn.setModalRows(formData, [ 'address_id' ], ()=>{
			$cache.then( async f => {
				// 物流人员
				$fn.setRow(formData, 'address_id', await f.getCache({ api:'box_address'} ) )
				//
				this.setState({ formData })
			})
		})
	}
	
	render(){
		return FormModal.call(this,{title:'分配', labelWidth:'s6', width:700, api:'box/updateaddress', onRefresh:()=> this.props.onRefresh() })
	}
}

export default Index